import request from '@/config/axios'
import { StudentVO } from '@/api/recruit/recruitstudent' // 面试评分 VO

// 面试评分 VO
export interface InterviewScoreVO {
  id: number // 主键
  batchId: string // 计划ID
  interviewId: string // 面试ID
  groupId: string // 分组ID
  userId: number // 评委ID
  recruitStudentId: string // 招生学生主键
  studentId: number // 学生ID
  score: number // 得分
  confirm: boolean // 是否确认
  remark: string // 备注
}

// 专家面试现场列表
export interface InterviewScoreSpecialistRespVO extends StudentVO {
  scoreId: number // 得分主键
  score: number // 得分
  scoreJudges: string // 已打分评委
  scoreJudgesCount: number // 已打分评委人数
  confirm: boolean // 是否确认
  confirmJudges: string // 面试成绩确认评委
  confirmJudgesCount: number // 面试成绩确认评委人数
  groupName: string // 面试分组
}

// 面试评分 API
export const InterviewScoreApi = {
  // 查询面试评分分页
  getInterviewScorePage: async (params: any) => {
    return await request.get({ url: `/recruit/interview-score/page`, params })
  },

  // 查询面试评分详情
  getInterviewScore: async (id: number) => {
    return await request.get({ url: `/recruit/interview-score/get?id=` + id })
  },

  // 新增面试评分
  createInterviewScore: async (data: InterviewScoreVO) => {
    return await request.post({ url: `/recruit/interview-score/create`, data })
  },

  // 修改面试评分
  updateInterviewScore: async (data: InterviewScoreVO) => {
    return await request.put({ url: `/recruit/interview-score/update`, data })
  },

  // 删除面试评分
  deleteInterviewScore: async (id: number) => {
    return await request.delete({ url: `/recruit/interview-score/delete?id=` + id })
  },

  // 导出面试评分 Excel
  exportInterviewScore: async (params) => {
    return await request.download({ url: `/recruit/interview-score/export-excel`, params })
  },

  // 专家面试现场获得面试评分分页
  getInterviewScoreSpecialistPage: async (params: any) => {
    return await request.get({ url: `/recruit/interview-score/specialist-page`, params })
  },

  // 专家面试现场评分
  giveInterviewSpecialistScore: async (data: Partial<InterviewScoreVO>) => {
    return await request.post({ url: `/recruit/interview-score/give-score`, data })
  },

  // 专家面试现场确认评分
  confirmInterviewSpecialistScore: async (id: number) => {
    return await request.put({ url: `/recruit/interview-score/confirm?id=${id}` })
  },

  // 专家面试现场确认评分
  confirmInterviewSpecialistScoreAll: async (groupId: number) => {
    return await request.put({ url: `/recruit/interview-score/confirm-all?groupId=${groupId}` })
  }
}
